home *** CD-ROM | disk | FTP | other *** search
/ s-gikan2.maizuru-ct.ac.jp / s-gikan2.maizuru-ct.ac.jp.zip / s-gikan2.maizuru-ct.ac.jp / pub / old / ncvc350_install.exe / {app} / scripts / by_scale.pl < prev    next >
Perl Script  |  2004-04-02  |  811b  |  32 lines

  1. #! /usr/bin/perl
  2.  
  3. #  NCâfü[â^Æåé╠ì└òWÆlé≡ÆΦé▀é╜öΣùªé╔ò╧è╖é╖éΘâXâNâèâvâg       #
  4. #  X,Y,Z,I,J,K,R,C,U,V,Wé╠îπé╠ÉöÄÜé¬É▌ÆΦé╡é╜ö{ùªé╔é╚éΘ      #
  5. #  ö{ùªé≡é⌐é»é╜Ælé¬0ê╚èOé╠É«Éöé╞é╚éΘé╞é½üAżÉöô_é≡òtë┴é╖éΘ  #
  6. #  ex.(ratio= 2.0;)  X50.3Y80Z30. -> X100.6Y160.Z60.        #
  7.  
  8. #######################
  9. #ö{ùªé≡ôⁿéΩé─é¡é╛é│éó
  10. $ratio = 2.0;
  11. #######################
  12.  
  13. $pre_file= $ARGV[0];
  14. $out_file= $ARGV[1];
  15. open(IN,$pre_file);
  16. open(OUT,">$out_file");
  17.  
  18. while(<IN>){
  19.     if(!/^N?[0-9\s]*[\(\%]/){
  20.         $new_line= "";
  21.         while(/([XYZIJKRCUVW])([\-\d\.]+)/){
  22.             ($pre_line,$char,$num,$_)= ($`,$1,$2,$');
  23.  
  24.             $num= int(int($num*1000) * $ratio);
  25.             $num= $num/1000;
  26.             if($num !~ /\./ and $num != 0){ $num= $num."\."; }
  27.             $new_line= $new_line.$pre_line.$char.$num;
  28.         }
  29.         $_= $new_line.$_;
  30.     }
  31.     print OUT;
  32. }